<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pretty="http://ocpsoft.com/prettyfaces"
	xmlns:security="http://www.springframework.org/security/facelets/tags"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition template="../templates/mainTemplate.xhtml">

	<ui:define name="ajaxStatus">
	</ui:define>

	<ui:define name="content">
		<div class="box">
			<h2>
				<a id="toggle-current-quotations" href="#"><h:outputText
						value="#{msg['mainMenu.currentQuotations']}" /></a>
			</h2>
			<div id="current-quotations" class="block tables">
				<p:ajaxStatus style="width:16px;height:16px;">
					<f:facet name="start">
						<p:graphicImage value="#{resource['img:ajaxloading.gif']}" />
					</f:facet>

					<f:facet name="complete">
						<h:outputText value="" />
					</f:facet>
				</p:ajaxStatus>

				<h:form>
					<p:dataTable var="quotation" widgetVar="quotationTable"
						value="#{quotationListBean.latestQuotations}" paginator="true"
						rows="30" paginatorPosition="top"
						emptyMessage="#{msg['prime.noRecordsFound']}"
						rowStyleClass="#{(quotation.dailyChange gt 0) ? 'positive' : ((quotation.dailyChange lt 0) ? 'negative' : null)}">
						<f:facet name="header">
							<p:outputPanel>
								<h:outputText
									value="#{msg['currentquotations.search']}" />
								<p:inputText id="globalFilter" onkeyup="quotationTable.filter()" />
							</p:outputPanel>
						</f:facet>
						<p:columnGroup type="header">
							<p:row>
								<p:column rowspan="2"
									headerText="#{msg['currentquotations.values']}"
									sortBy="#{quotation.company.name}"
									filterBy="#{quotation.company.name}"
									filterMatchMode="startsWith" filterStyle="display: none;" />
								<p:column colspan="4"
									headerText="#{msg['currentquotations.sharePrice']}" />
								<p:column rowspan="2"
									headerText="#{msg['currentquotations.change']}"
									sortBy="#{quotation.dailyChange}" />
								<p:column colspan="2"
									headerText="#{msg['currentquotations.circulation']}" />
								<p:column rowspan="2"
									headerText="#{msg['currentquotations.time']}"
									sortBy="#{quotation.formattedTime}" />
							</p:row>

							<p:row>
								<p:column headerText="#{msg['currentquotations.open']}"
									sortBy="#{quotation.openValue}" />
								<p:column headerText="#{msg['currentquotations.minimum']}"
									sortBy="#{quotation.minimumValue}" />
								<p:column headerText="#{msg['currentquotations.maximum']}"
									sortBy="#{quotation.maximumValue}" />
								<p:column headerText="#{msg['currentquotations.current']}"
									sortBy="#{quotation.currentValue}" />
								<p:column headerText="#{msg['currentquotations.item']}"
									sortBy="#{quotation.tradingVolume}" />
								<p:column headerText="#{msg['currentquotations.price']}"
									sortBy="#{quotation.marketValue}" />
							</p:row>
						</p:columnGroup>

						<p:column>
							<pretty:link mappingId="companyDetails">
								<f:param value="#{quotation.company.name}" />
								<h:outputText value="#{quotation.company.name}" />
							</pretty:link>
						</p:column>

						<p:column>
							<h:outputText value="#{quotation.openValue}" />
						</p:column>

						<p:column>
							<h:outputText value="#{quotation.minimumValue}" />
						</p:column>

						<p:column>
							<h:outputText value="#{quotation.maximumValue}" />
						</p:column>

						<p:column>
							<h:outputText value="#{quotation.currentValue}" />
						</p:column>

						<p:column>
							<h:outputText value="#{quotation.dailyChange}" />%
					        </p:column>

						<p:column>
							<h:outputText value="#{quotation.tradingVolume}" />
						</p:column>

						<p:column>
							<h:outputText value="#{quotation.marketValue}" />
						</p:column>

						<p:column>
							<h:outputText value="#{quotation.formattedTime}" />
						</p:column>
					</p:dataTable>
				</h:form>
			</div>
		</div>
	</ui:define>
</ui:composition>

</html>
